package server

import (
	"blog/middleware"
	"blog/routers"
	"blog/utils"
	"github.com/gin-gonic/gin"
)

func InitRouter() {
	gin.SetMode(utils.AppMode)
	r := gin.New()
	r.Use(middleware.Cors())
	r.Use(middleware.Log())
	r.Use(gin.Recovery())
	router := r.Group("api/v1")
	{
		routers.InitUserRouter(router)
		routers.InitCategoryRouter(router)
		routers.InitArticleRouter(router)
	}
	r.Run(utils.HttpPort)
}
